/**************************************************************************
 *
 * Copyright (C) 2007 University of California, Los Angeles.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 *************************************************************************/

package edu.ucla.cs.typecast.net;

import java.io.IOException;

import edu.ucla.cs.typecast.bloomfilter.BloomFilter;

/**
 * 
 * This class manages a network end point. It provides functionalties
 * to activate and deactivate the end point, update the Local Bloom filter
 * associated with this end point.  It is also responsible for 
 * listening to the incoming network packets and dispatches it to 
 * upper layer. 
 * 
 * @date Jul 25, 2007
 *
 */
public interface EndPointListener {
	/**
	 * Activate a network end point
	 * @param endPoint The EndPoint to be activated
	 * @return  The EndPoint that have been activated, note that this value
	 * can be different from the required EndPoint because the Required EndPoint
	 * may not specify certain property such as port. 
	 * @throws IOException
	 */
	public EndPoint activate(EndPoint endPoint) throws IOException ; 
	/**
	 * Update the Local Bloom Filter associated with a network end point. 
	 * @param endPoint
	 * @param LBF
	 * @throws IOException
	 */
	public void update(EndPoint endPoint, BloomFilter LBF) throws IOException; 
	/**
	 * Deactivate a network end point
	 * @param endPoint
	 * @throws IOException
	 */
	public void deactivate(EndPoint endPoint) throws IOException; 
	
		
	/**
	 * Check whether the end point is active. 
	 * @return
	 */
	public boolean isActive(); 
	
	/**
	 * Set the dispatcher that is responsible for deliver the network 
	 * packets to the upper layer applications. 
	 * @param dispatcher
	 */
    public void setTypeCastDispatcher(TypeCastDispatcher dispatcher); 
}
